import request from '@/utils/request.js'

// 获取员工列表
export const getEmployeesListAPI = (params) => {
  return request({
    url: '/sys/user',
    params
  })
}

// 新增员工
export const AddEmployeeAPI = (data) => {
  return request({
    method: 'POST',
    url: '/sys/user',
    data
  })
}

/**
 * @description: 删除员工
 * @param {*} id 员工id
 * @return {*}
 */
export function delEmployeeAPI(id) {
  return request({
    method: 'delete',
    url: `/sys/user/${id}`
  })
}

// 员工管理-Excel导入接口调用
export const importEmployeeAPI = (data) => {
  return request({
    method: 'POST',
    url: '/sys/user/batch',
    data
  })
}

// 保存员工基本信息
export const saveEmployeeInfoAPI = empobj => {
  return request({
    method: 'PUT',
    url: '/sys/user/' + empobj.id,
    data: empobj
  })
}

// 给员工分配角色
export const setEmployeeRoleAPI = data => {
  return request({
    method: 'PUT',
    url: '/sys/user/assignRoles',
    data
  })
}
